get last element of array javascript